package com.tt.fashionWebSite.domain;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * Created by 10520_000 on 10/30/14.
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "chi_tiet_san_pham")
@NamedQueries({
//        @NamedQuery(name = "User.searchAllUser",query = "SELECT u FROM User u") ,
})
public class ChiTietSanPhamFull implements Serializable {
   @Id
   @Column(name = "MA_CT_SP")
   private String maCTSP;

   @ManyToOne
   @JoinColumn(name = "MA_SP")
   private SanPham sanPham;

   @ManyToOne
   @JoinColumn(name = "MA_MAU_SAC")
   private MauSac mauSac;

   @ManyToOne
   @JoinColumn(name = "MA_SIZE")
   private KichThuoc kichThuoc;

   @ManyToOne
   @JoinColumn(name = "MA_HOA_TIET")
   private HoaTiet hoaTiet;

   @Column(name = "GIA_SP")
   private Double giaSP;

   @Column(name = "SO_LUONG")
   private Long soLuong;

   @LazyCollection(LazyCollectionOption.FALSE)
   @OneToMany(mappedBy = "chiTietSanPham", cascade = {CascadeType.ALL}, orphanRemoval = true)
   private List<ChiTietKhuyenMai> chiTietKhuyenMai;

   @LazyCollection(LazyCollectionOption.FALSE)
   @OneToMany(mappedBy = "chiTietSanPham", cascade = {CascadeType.ALL}, orphanRemoval = true)
   private List<HinhAnhSanPham> hinhAnhSanPham;

   public String getMaCTSP() {
      return maCTSP;
   }

   public void setMaCTSP(String maCTSP) {
      this.maCTSP = maCTSP;
   }

   public SanPham getSanPham() {
      return sanPham;
   }

   public void setSanPham(SanPham sanPham) {
      this.sanPham = sanPham;
   }

   public MauSac getMauSac() {
      return mauSac;
   }

   public void setMauSac(MauSac mauSac) {
      this.mauSac = mauSac;
   }

   public KichThuoc getKichThuoc() {
      return kichThuoc;
   }

   public void setKichThuoc(KichThuoc kichThuoc) {
      this.kichThuoc = kichThuoc;
   }

   public Double getGiaSP() {
      return giaSP;
   }

   public void setGiaSP(Double giaSP) {
      this.giaSP = giaSP;
   }

   public Long getSoLuong() {
      return soLuong;
   }

   public void setSoLuong(Long soLuong) {
      this.soLuong = soLuong;
   }

   public HoaTiet getHoaTiet() {
      return hoaTiet;
   }

   public void setHoaTiet(HoaTiet hoaTiet) {
      this.hoaTiet = hoaTiet;
   }

   public List<ChiTietKhuyenMai> getChiTietKhuyenMai() {
      return chiTietKhuyenMai;
   }

   public void setChiTietKhuyenMai(List<ChiTietKhuyenMai> chiTietKhuyenMai) {
      this.chiTietKhuyenMai = chiTietKhuyenMai;
   }

   public List<HinhAnhSanPham> getHinhAnhSanPham() {
      return hinhAnhSanPham;
   }

   public void setHinhAnhSanPham(List<HinhAnhSanPham> hinhAnhSanPham) {
      this.hinhAnhSanPham = hinhAnhSanPham;
   }
}
